require "./EmpEdit.css"
{SysEdit} = require "./SysEdit"
{EmpAdd} = require "./EmpAdd"
{Srv} = require "Srv"

SuperClzz = EmpAdd
exports.EmpEdit = new Class
  Extends: SuperClzz
  Implements: [SysEdit]
  SuperClzz: SuperClzz
  setPgVal: (eny,headArr)->
    t = this
    o = t.options
    elt = o.ele
    eny = eny or {}
    headArr = headArr or o.headArr
    headArr = headArr.clone()
    headArr.erase "picture"
    if eny.picture
      uid = yield o.thisSrv.ajax "oid2uid",[eny.picture]
      if uid
        pictrueEl = elt.getE "[h:iez='picture']"
        pictrueWg = pictrueEl.wg()
        pictrueWg.setVal uid
    yield SuperClzz.prototype.setPgVal.apply t,[eny,headArr]
    return
  setPgOldVal: (eny,headArr)->
    t = this
    o = t.options
    elt = o.ele
    headArr = headArr or o.headArr
    headArr = headArr.clone()
    headArr.erase "picture"
    SuperClzz.prototype.setPgOldVal.apply t,[eny,headArr]
    pictrueEl = elt.getE "[h:iez='picture']"
    pictrueWg = pictrueEl.wg()
    uid = yield pictrueWg.getVal()
    pictrueWg.setOldVal uid
    return
  